package com.xd.study.utility;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;

/**
 * Created by DGF on 2015/5/5.
 * 要在AndroidManifest.xml中注册
 */
public class MyStartService extends Service {


    @Override
    public IBinder onBind(Intent intent) {
        Log.i("service", "onBind");
        return null;
    }

    /**
     * 只调用一次
     */
    @Override
    public void onCreate() {
        Log.i("service", "onCreate");
        super.onCreate();
    }

    /**
     * 多次调用
     * @param intent
     * @param flags
     * @param startId
     * @return
     */
    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i("service", "onStartCommand");
        return super.onStartCommand(intent, flags, startId);
    }

    /**
     * 只调用一次
     */
    @Override
    public void onDestroy() {
        Log.i("service", "onDestroy");
        super.onDestroy();
    }
}
